import loading from '@/base/loading/loading.vue'
import taskModal from '@/base/taskModal/taskModal.vue'
import systemSelect from '@/base/systemSelect/systemSelect.vue'
import systemButton from '@/base/systemButton/systemButton.vue'
import Drag from '@/directive/drag'
import { dateFormat, sizeFormat, timeFormat } from '@/utils/utils'
import type { App } from 'vue'

const globalFun = {
  install: (app: App): void => {
    app.config.globalProperties.$dateFormat = dateFormat
    app.config.globalProperties.$timeFormat = timeFormat
    app.config.globalProperties.$sizeFormat = sizeFormat
    app.component('Loading', loading)
    app.component('TaskModal', taskModal)
    app.component('SystemSelect', systemSelect)
    app.component('SystemButton', systemButton)
    app.directive('drag', Drag)
  }
}

export default globalFun
